import config from './config'
export default function (url, data = {}, method = 'GET') {
  return new Promise((resolve, reject) => {
    wx.request({
      url: config.host + url,
      data,
      method,
      header: {
        cookie: 'MUSIC_U=200f728d33aa825c192e6ec11ebb811591682487c439966f30eefeb5279efa619fe0240d96d3c20aeaee740502d8e77a4f0661b6a670c3336dee108ffa25353140544341ff11443dd4dbf082a8813684; Max-Age=1296000; Expires=Sat, 09 Jul 2022 02:49:05 GMT; Path=/; Domain=.music.163.com; HTTPOnly'
      },
      success: res => {
        resolve(res.data)
      },
      fail: error => {
        reject(error)
      }
    })
  })
}